package com.loriot.common.single_number_ii_137;

public class Main {
    class Solution {
        public int singleNumber(int[] nums) {
            int a = 0;
            int b = 0;
            for(int item : nums){
                int anext = (a&~b&~item) | (~a&b&item);
                int bnext = ~a&(b^item);
                a = anext;
                b = bnext;
            }
            return b;
        }
    }
}
